package tt.t1;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import tt.t.EnableMytest;
import tt.t.IService;

@SpringBootApplication
@RestController
@EnableMytest
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
        String[] beanDefinitionNames = SpringApplication.run(Main.class, args).getBeanDefinitionNames();
        for (String beanDefinitionName : beanDefinitionNames) {
            System.out.println(beanDefinitionName);
        }
        System.out.println(beanDefinitionNames.length);
        System.out.println("Hello world!");
    }
    @Autowired
    private IService service;
    @GetMapping("/hello")
    public String hello() {
        service.sayHello();
        return "Hello world!";
    }
}
/**
 * 方式一：@EnableMytest + 配置类 + 配置[mytest: enable: true]
 * 方式二：org.springframework.boot.autoconfigure.AutoConfiguration.imports + 配置[mytest: enable: true] + 配置类
 * SpringBoot2：spring.factories
 */